<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>

<div id="app">
    <input @keyup="calculate"
           type="text"
           v-model="num1">
    <span>+</span>
    <input @keyup="calculate"
           type="text"
           v-model="num2">
    <span>=</span>
    <input type="text"
           :value="sum">
    <br>
    <br>
    <button @click="reset">
        清空数据
    </button>
</div>
<script>
    const app = new Vue({
        el: "#app",
        data: {
            num1: '',
            num2: '',
            sum: ''
        },
        methods: {
            calculate () {
                this.sum = Number(this.num1)
                    +
                    Number(this.num2);
            },
            reset () {
                this.sum = this.num1  = this.num2 = '';
                this.$emit('add')
            }
        }
    });
</script>

</body>
</html>